home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: uu4news.netcom.com!zodiac!szh
- From: szh@zcon.com (Syed Zaeem Hosain)
- Subject: Re: Help creating dir's in C
- Message-ID: <1996Mar9.011243.28649@zcon.com>
- Sender: szh@zcon.com (Syed Zaeem Hosain)
- Nntp-Posting-Host: zodiac
- Reply-To: szh@zcon.com
- Organization: Z Consulting Group
- References: <4hlvu4$2hc@news.voicenet.com>
- Date: Sat, 9 Mar 1996 01:12:43 GMT
-
- In article <4hlvu4$2hc@news.voicenet.com>, The Hermit <deaton@cygnus.rsabbs.com> writes:
- > Please help me! I'm really stuck on this program that I'm writing in C/C++. I using Borland's Turbo C/C++ compiler 3.0 for DOS.
- >What I need to know how to do is create and remove DOS directories WITHIN the C program. I've even tried using inline ASM routines
- >and calling BIOS interrupts, but I'm not too keen on ASM and I crashed my PC. :) Any replies are appreciated...
-
- This is "off-topic" for this newsgroup. But I did not see anything in
- the FAQ to point you towards ... so here is something to check out: if
- you look in your compiler's library reference manual, you might find
- information on two functions called mkdir() and rmdir() ... I do not
- have your compiler so I cannot be more certain than this fairly general
- suggestion. If your library has these functions, they should work for
- your needs.
-
- In addition, calls to the system() function may also work. This is what
- I tried on my Sun UNIX system, so this should give you some feeling for
- what is possible (this code does not do error checking, correct direc-
- tory name validation, checking the return value, etc. ... this is left
- as an exercise for you!):
-
- zodiac{186}szh: cat foo.c
- #include <stdio.h>
-
- main ( void )
- {
- system ( "mkdir testdir" );
- return (0);
- }
- zodiac{187}szh: cat bar.c
- #include <stdio.h>
-
- main ( void )
- {
- system ( "rmdir testdir" );
- return (0);
- }
- zodiac{188}szh: gcc -o foo foo.c
- zodiac{189}szh: gcc -o bar bar.c
- zodiac{190}szh: ls -lF
- total 50
- -rwxr-xr-x 1 szh 24576 Mar 8 17:10 bar*
- -rw-r--r-- 1 szh 82 Mar 8 17:08 bar.c
- -rwxr-xr-x 1 szh 24576 Mar 8 17:10 foo*
- -rw-r--r-- 1 szh 82 Mar 8 17:08 foo.c
- zodiac{191}szh: foo
- zodiac{192}szh: ls -lF
- total 51
- -rwxr-xr-x 1 szh 24576 Mar 8 17:10 bar*
- -rw-r--r-- 1 szh 82 Mar 8 17:08 bar.c
- -rwxr-xr-x 1 szh 24576 Mar 8 17:10 foo*
- -rw-r--r-- 1 szh 82 Mar 8 17:08 foo.c
- drwxr-xr-x 2 szh 512 Mar 8 17:10 testdir/
- zodiac{193}szh: bar
- zodiac{194}szh: ls -lF
- total 50
- -rwxr-xr-x 1 szh 24576 Mar 8 17:10 bar*
- -rw-r--r-- 1 szh 82 Mar 8 17:08 bar.c
- -rwxr-xr-x 1 szh 24576 Mar 8 17:10 foo*
- -rw-r--r-- 1 szh 82 Mar 8 17:08 foo.c
- zodiac{195}szh:
-
- Z
-
-
- --
- -------------------------------------------------------------------------
- | Syed Zaeem Hosain P. O. Box 610097 (408) 441-7021 |
- | Z Consulting Group San Jose, CA 95161 szh@zcon.com |
- -------------------------------------------------------------------------
-